import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';

import '../../../../net/api_provider.dart';
import '../../../../utils/sp_util.dart';
import '../../../routes/app_pages.dart';

class ConfirmController extends GetxController {

  var str = ''.obs;

  @override
  void onReady() {
    super.onReady();

    // str.value = '借款由“xxx”提供'; // TODO

  }

  ApiProvider apiProvider = Get.find();
  void submit() async {
    Map<String, dynamic> map = {};
    map['loan_amount'] = int.parse(Get.parameters['loan_amount']!);
    map['loan_period_id'] = int.parse(Get.parameters['loan_period_id']!);
    map['loan_type'] = int.parse(Get.parameters['loan_type']!);
    map['channel_id'] = SpUtil.read(SpUtil.CHANNEL_ID, '');
    var result = await apiProvider.getData(map, ApiProvider.loan_updated);
    if(result.code == 200){
      Get.offNamed(Routes.RESULT);
    }else{
      EasyLoading.showToast('${result.msg}');
    }
  }
}
